package videoExercises;

import java.util.LinkedList;

/*
用LinkedList实现队列的入队(enqueue)、出队(dequeue)和判空(isEmpty)方法，并测试添加3个字
符串后依次出队打印 。
 */
public class T3LinkedList <T>{
    private LinkedList<T> list =new LinkedList<>();
    public void enqueue(T t){
        list.addLast(t);
    }
    public T dequeue(){
        if(isEmpty()){
            throw new RuntimeException("队列为空");
        }
            return list.removeFirst();

    }
    public boolean isEmpty(){
        return list.isEmpty();
    }

}
